package top.houry.grpc.service;

import io.grpc.ManagedChannelBuilder;
import top.houry.grpc.proto.GreeterGrpc;
import top.houry.grpc.proto.GrpcProto;

public class GrpcClient {

    public static void main(String[] args) {

        GrpcProto.HelloRequest request = GrpcProto.HelloRequest.newBuilder().setName("houry").build();


        GreeterGrpc.GreeterBlockingStub blockingStub = GreeterGrpc.newBlockingStub(ManagedChannelBuilder.forAddress("localhost", 9999)
                // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid
                // needing certificates.
                .usePlaintext()
                .build());
        GrpcProto.HelloReply helloReply = blockingStub.syaHello(request);
        System.out.println(helloReply.getMessage());

    }

}
